com.willowtreeapps.android.shared
Class OAKImageCache

java.lang.Object
  extended by com.github.droidfu.cachefu.AbstractCache<String,byte[]>
      extended by com.github.droidfu.cachefu.ImageCache
          extended by com.willowtreeapps.android.shared.OAKImageCache
All Implemented Interfaces:
Map<String,byte[]>

public class OAKImageCache
extends ImageCache


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String LOG_TAG
           
 
Fields inherited from class com.github.droidfu.cachefu.AbstractCache
DEFAULT_BUFFER_SIZE, DISK_CACHE_INTERNAL, DISK_CACHE_SDCARD, diskCacheDirectory
 
Constructor Summary
OAKImageCache(int initialCapacity, long expirationInMinutes, int maxConcurrentThreads)
           
 
Method Summary
protected  void cacheToDisk(String key, byte[] value)
           
 android.graphics.Bitmap getBitmap(Object elementKey)
           
 int getCacheAllocated()
           
 int getCacheLimit()
           
 android.content.Context getContext()
           
protected  int getImageArea(byte[] data)
           
 boolean isSafeMode()
           
 byte[] put(String imageUrl, byte[] data)
          Writes an element to the cache.
 void putToDisk(String imageUrl, byte[] data)
           
 void setCacheLimit(int newLimit)
          Set how large the cache may grow before old images are discarded.
 void setContext(android.content.Context context)
           
 void setSafeMode(boolean safeMode)
           
 void updateContents()
          Populates the cache with information about images already on disk.
 
Methods inherited from class com.github.droidfu.cachefu.ImageCache
getFileNameForKey, readValueFromDisk, removeAllWithPrefix, writeValueToDisk
 
Methods inherited from class com.github.droidfu.cachefu.AbstractCache
clear, containsKey, containsKeyInMemory, containsValue, enableDiskCache, entrySet, get, getDiskCacheDirectory, getFileForKey, isDiskCacheEnabled, isEmpty, keySet, putAll, remove, removeKey, setDiskCacheEnabled, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

LOG_TAG

public static final String LOG_TAG
Constructor Detail

OAKImageCache

public OAKImageCache(int initialCapacity,
                     long expirationInMinutes,
                     int maxConcurrentThreads)
Method Detail

getBitmap

public android.graphics.Bitmap getBitmap(Object elementKey)
Overrides:
getBitmap in class ImageCache

put

public byte[] put(String imageUrl,
                  byte[] data)
Description copied from class: AbstractCache
Writes an element to the cache. NOTE: If disk caching is enabled, this will write through to the disk, which may introduce a performance penalty.

Specified by:
put in interface Map<String,byte[]>
Overrides:
put in class AbstractCache<String,byte[]>

putToDisk

public void putToDisk(String imageUrl,
                      byte[] data)

getCacheAllocated

public int getCacheAllocated()

getCacheLimit

public int getCacheLimit()

setCacheLimit

public void setCacheLimit(int newLimit)
Set how large the cache may grow before old images are discarded.

Parameters:
newLimit - New cache size in bytes.

updateContents

public void updateContents()
Populates the cache with information about images already on disk. Should be run after enabling disk caching -- if not, previously existing images on disk will not be considered toward allocation limits and old image removal.


cacheToDisk

protected void cacheToDisk(String key,
                           byte[] value)
Overrides:
cacheToDisk in class AbstractCache<String,byte[]>

getImageArea

protected int getImageArea(byte[] data)

getContext

public android.content.Context getContext()

setContext

public void setContext(android.content.Context context)

isSafeMode

public boolean isSafeMode()

setSafeMode

public void setSafeMode(boolean safeMode)


Copyright © 2011. All Rights Reserved.